<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <#include "/pubHeadStyleTree.html">
</head>
<body>
<div style="height: 100%;">
<form class="layui-form" style="background: #fff;position: relative;height: 100%;" id="taskReminderForm">
    <div class="layui-tab taskTableShou" style="position: absolute;left: 5px;top: 10px;bottom:10px;right: 40px; margin: 0;">
        <ul class="layui-tab-title">
            <li class="layui-this">催办基本信息设置</li>
            <li>站内消息内容</li>
        </ul>
        <div class="layui-tab-content" style="height: 380px;overflow-y: auto;">
            <div class="layui-tab-item layui-show">
                <fieldset class="layui-elem-field">
                    <legend>到期条件设置</legend>
                    <div class="layui-field-box">
                        <table class="layui-table">
                            <tr>
                                <td>名称：</td>
                                <td><input type="text" id="name" name="name" autocomplete="off"  class="layui-input" value="${taskReminder.name}"></td>
                                <td>当前节点：</td>
                                <td><input type="text" class="layui-input" value="${nodeId}" disabled></td>
                            </tr>
                            <tr>
                                <td>相对节点：</td>
                                <td>
                                    <select name="relativeNodeId">
                                        <#list nodes as node>
                                            <option value="${node.nodeId}" <#if node.nodeId==taskReminder.relativeNodeId>selected="selected"</#if>>${node.nodeName}</option>
                                        </#list>
                                    </select>
                                </td>
                                <td>相对动作：</td>
                                <td>
                                    <select name="relativeNodeType">
                                        <option value="0" >创建</option>
                                        <option value="1" <#if taskReminder.relativeNodeType==1>selected="selected"</#if>>完成</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>相对时间：</td>
                                <td id="completeTr">
                                    <div class="layui-input-inline time">
                                        <input class="layui-input time dayInput" type="text" name="completeTimeDay" value="${completeTimeDay}" lay-verify="number"/>
                                    </div>
                                    <span>天</span>
                                    <div class="layui-input-inline time">
                                        <select name="completeTimeHour" class="hourInput">
                                            <#list 0..23 as h>
                                                <option value="${h}" <#if completeTimeHour==h>selected="selected"</#if>>${h}</option>
                                            </#list>
                                        </select>
                                    </div>
                                    <span>小时</span>
                                    <div class="layui-input-inline time">
                                        <select  name="completeTimeMinute" class="minuteInput">
                                            <#list 0..4 as m>
                                                <option value="${m}" <#if completeTimeMinute==m>selected="selected"</#if>>${m}</option>
                                            </#list>
                                            <#list 1..11 as m>
                                                <option value="${m*5}" <#if completeTimeMinute==m*5>selected="selected"</#if>>${m*5}</option>
                                            </#list>
                                        </select>
                                    </div>
                                    <span>分钟</span>
                                </td>
                                <td>相对时间类型：</td>
                                <td>
                                    <select name="relativeTimeType">
                                        <!--<option value="0">工作日</option>-->
                                        <option value="1" <#if taskReminder.relativeTimeType==1>selected="selected"</#if>>日历日</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td><a href="javascript:;"  id="tip" ><i class="iconfont iconicon_yiwenkongxin" style="font-size: 20px"></i></a>条件表达式：</td>
                                <td colspan="3">
                                    <div>
                                        <span class="commonScript" style="cursor: pointer;">
                                            <i class="layui-icon layui-icon-fonts-code"></i>常用脚本
                                        </span>
                                        <span class="green">表单变量</span>
                                        <div class="layui-input-inline" style="width: 150px !important;">
                                            <select name="flowVar" lay-filter="flowVar">
                                                <option value="">请选择...</option>
                                                <optgroup label="表单变量"></optgroup>
                                                <#list flowVars as flowVar>
                                                    <option value="${flowVar.fieldName}" fname="${flowVar.fieldName}" fdesc="${flowVar.fieldDesc}" ftype="${flowVar.fieldType}">${flowVar.fieldDesc}</option>
                                                </#list>
                                                <#if defVars??  && (defVars?size >0)>
                                                    <optgroup label="自定义变量"></optgroup>
                                                    <#list defVars as defVar>
                                                        <option value="${defVar.varKey}"  fname="${defVar.varKey}" fdesc="${defVar.varName}" ftype="${defVar.varDataType}">${defVar.varName}</option>
                                                    </#list>
                                                </#if>
                                            </select>
                                        </div>
                                    </div>
                                    <textarea name="condExp" class="layui-textarea" id="condExp">${taskReminder.condExp}</textarea>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                <fieldset class="layui-elem-field">
                    <legend>发送催办消息设置</legend>
                    <div class="layui-field-box">
                        <table class="layui-table">
                            <tr>
                                <td style="width: 132px;">发送催办信息：</td>
                                <td colspan="3">
                                    <input type="checkbox" id="needSendMsg" name="needSendMsg" lay-filter="needSendMsg" title="发送" lay-skin="primary">
                                </td>
                            </tr>
                            <tr class="send-msg-tr">
                                <td>开始发送时间：</td>
                                <td colspan="3" id="startTr">
                                    <div class="layui-input-inline time">
                                        <input class="layui-input time dayInput" type="text" name="reminderStartDay" value="${reminderStartDay}" lay-verify="number"/>
                                    </div>
                                    <span>天</span>
                                    <div class="layui-input-inline time">
                                        <select name="reminderStartHour" class="hourInput">
                                            <#list 0..23 as h>
                                                <option value="${h}" <#if reminderStartHour==h>selected="selected"</#if>>${h}</option>
                                            </#list>
                                        </select>
                                    </div>
                                    <span>小时</span>
                                    <div class="layui-input-inline time">
                                        <select  name="reminderStartMinute" class="minuteInput">
                                            <#list 0..4 as m>
                                                <option value="${m}" <#if reminderStartMinute==m>selected="selected"</#if>>${m}</option>
                                            </#list>
                                            <#list 1..11 as m>
                                                <option value="${m*5}" <#if reminderStartMinute==m*5>selected="selected"</#if>>${m*5}</option>
                                            </#list>
                                        </select>
                                    </div>
                                    <span>分钟</span>
                                </td>
                            </tr>
                            <tr class="send-msg-tr">
                                <td>发送的间隔：</td>
                                <td id="endTr">
                                    <div class="layui-input-inline time">
                                        <input class="layui-input time dayInput" type="text" name="reminderEndDay" value="${reminderEndDay}" lay-verify="number"/>
                                    </div>
                                    <span>天</span>
                                    <div class="layui-input-inline time">
                                        <select name="reminderEndHour" class="hourInput">
                                            <#list 0..23 as h>
                                                <option value="${h}" <#if reminderEndHour==h>selected="selected"</#if>>${h}</option>
                                            </#list>
                                        </select>
                                    </div>
                                    <span>小时</span>
                                    <div class="layui-input-inline time">
                                        <select  name="reminderEndMinute" class="minuteInput">
                                            <#list 1..4 as m>
                                                <option value="${m}" <#if reminderEndMinute==m>selected="selected"</#if>>${m}</option>
                                            </#list>
                                            <#list 1..11 as m>
                                                <option value="${m*5}" <#if reminderEndMinute==m*5>selected="selected"</#if>>${m*5}</option>
                                            </#list>
                                        </select>
                                    </div>
                                    <span>分钟</span>
                                </td>
                                <td>发送信息次数: </td>
                                <td>
                                    <select name="times" id="times">
                                        <#list 0..10 as i>
                                            <option value="${i}" <#if taskReminder.times==i>selected="selected"</#if>>${i}</option>
                                        </#list>
                                    </select>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                <fieldset class="layui-elem-field">
                    <legend>到期动作设置</legend>
                    <div class="layui-field-box">
                        <table class="layui-table">
                            <tr>
                                <td style="width: 132px;">执行动作：</td>
                                <td>
                                    <select name="action" lay-filter="action">
                                        <option value="0">无动作</option>
                                        <option value="1">执行同意操作</option>
                                        <option value="2">执行反对操作</option>
                                        <option value="3">执行驳回操作</option>
                                        <option value="4">执行驳回到发起人操作</option>
                                        <option value="5">执行交办操作</option>
                                        <option value="6">结束该流程</option>
                                        <option value="7">调用指定方法</option>
                                    </select>
                                </td>
                            </tr>
                            <tr class="execute-script">
                                <td>执行脚本: </td>
                                <td>
                                    <div>
                                        <span class="commonScript" style="cursor: pointer;">
                                            <i class="layui-icon layui-icon-fonts-code"></i>常用脚本
                                        </span>
                                        <span class="green">表单变量:</span>
                                        <div class="layui-input-inline" style="width: 150px !important;">
                                            <select name="flowVar" lay-filter="flowVar">
                                                <option value="">请选择...</option>
                                                <optgroup label="表单变量"></optgroup>
                                                <#list flowVars as flowVar>
                                                <option value="${flowVar.fieldName}" fname="${flowVar.fieldName}" fdesc="${flowVar.fieldDesc}" ftype="${flowVar.fieldType}">${flowVar.fieldDesc}</option>
                                            </#list>
                                            </select>
                                        </div>
                                    </div>
                                    <textarea name="script" class="layui-textarea" id="script">${taskReminder.script}</textarea>
                                </td>
                            </tr>
                            <tr class="choose-assigner">
                                <td>指定交办人员：</td>
                                <td>
                                    <input type="hidden" name="assignerId" value="${taskReminder.assignerId}"/>
                                    <input type="text" class="layui-input shortInput" name="assignerName" readonly="readonly" value="${taskReminder.assignerName}"/>
                                    <button type="button" class="layui-btn layui-btn-sm chooseAssigner">选择</button>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                <fieldset class="layui-elem-field">
                    <legend>任务紧急程度预警设置</legend>
                    <div class="layui-field-box">
                        <table class="layui-table" id="taskWarningSetList">
                            <thead>
                            <tr>
                                <td colspan="5" style="text-align: center">
                                    <a class="layui-btn layui-btn-sm" onclick="addWarning()">
                                        <i class="layui-icon layui-icon-add-1"></i>
                                        <span>增加预警项</span>
                                    </a>
                                    <span style="color: gray;">到期动作为“无动作”时方才有效</span>
                                </td>
                            </tr>
                            <tr>
                                <th style="width:100px;" class="th">名称</th>
                                <th style="width:100px;" class="th">相对到期类型</th>
                                <th class="th">相对时间</th>
                                <th class="th">紧急程度</th>
                                <th class="th">管理</th>
                            </tr>
                            </thead>
                            <#list taskReminder.taskWarningSetList as warningSet>
                                <tr>
                                    <td>
                                        <input class="layui-input" type="text" name="warnName" value="${warningSet.name}"/>
                                    </td>
                                    <td>
                                        <select name="relativeType" >
                                            <option value="before" <#if warningSet.relativeType=="before">selected="selected"</#if>>之前</option>
                                            <option value="after" <#if warningSet.relativeType=="after">selected="selected"</#if>>之后</option>
                                        </select>
                                    </td>
                                    <td>
                                        <div class="layui-input-inline time">
                                            <input class="layui-input time" type="text" name="reminderDueDay" value="${warningSet.reminderDueDay}" lay-verify="number"/>
                                        </div>
                                        <span>天</span>
                                        <div class="layui-input-inline time">
                                            <select name="reminderDueHour">
                                            <#list 0..23 as h>
                                                <option value="${h}" <#if warningSet.reminderDueDay==h>selected="selected"</#if>>${h}</option>
                                            </#list>
                                            </select>
                                        </div>
                                        <span>小时</span>
                                        <div class="layui-input-inline time">
                                            <select  name="reminderDueMinute">
                                            <#list 1..4 as m>
                                                <option value="${m}" <#if warningSet.reminderDueMinute==m>selected="selected"</#if>>${m}</option>
                                            </#list>
                                            <#list 1..11 as m>
                                                <option value="${m*5}" <#if warningSet.reminderDueMinute==m*5>selected="selected"</#if>>${m*5}</option>
                                            </#list>
                                            </select>
                                        </div>
                                        <span>分钟</span>
                                    </td>
                                    <td>
                                        <select name="level">
                                            <#list warningSettingList as warningSetting>
                                                <option value="${warningSetting.level}" <#if warningSet.level==warningSetting.level>selected="selected"</#if>>${warningSetting.name}</option>
                                            </#list>
                                        </select>
                                    </td>
                                    <td>
                                        <a class="layui-btn layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>
                                    </td>
                                </tr>
                            </#list>
                        </table>
                    </div>
                </fieldset>
            </div>
            <div class="layui-tab-item">
                <table class="layui-table">
                    <tr>
                        <td style="width: 150px;">站内消息内容：</td>
                        <td>
                            <i class="layui-icon layui-icon-templeate-1"><a href="javascript:;" onclick="slectTemplate()"><span style="font-size: 14px;">选择模板内容</span></a></i>
                            <textarea id="msgContent" name="msgContent" style="display: none;">${taskReminder.msgContent}</textarea>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <div class="tablesize roles" style="position: absolute;top:0;right:0px;bottom: 0; padding:10px;">
        <div class="taskDetails Open">
            <p class="clearfix">
                <i class="layui-icon layui-icon-prev prevs layui-icon-next"></i>
                <span>任务明细</span>
            </p>
            <div  style="height: 550px;overflow-y: auto;">
                <table class="table-detail tableDetails layui-table" lay-filter="managementTable" id="managementTable">
                    <tr>
                        <th style="text-align: center;">名称</th>
                        <th style="text-align: center;">管理</th>
                    </tr>
                    <#list taskReminders as reminder>
                    <tr>
                        <td onclick="edit('${reminder.taskDueId}')">
                            <span>${reminder.name}</span>
                        </td>
                        <td>
                            <a class="layui-btn layui-btn-danger layui-btn-xs" href="javascript:;" onclick="delReminder('${reminder.taskDueId}')">
                                <i class="layui-icon layui-icon-delete"></i>删除
                            </a>
                        </td>
                    </tr>
                </#list>
                </table>
            </div>

        </div>
    </div>
    <input type="hidden" id="taskDueId" name="taskDueId" value="${taskReminder.taskDueId}" />
    <input type="hidden" id="procDefId" name="procDefId" value="${procDefId}" />
    <input type="hidden" id="parentProcDefId" name="parentProcDefId" value="${parentProcDefId}" />
    <input type="hidden" id="nodeId" name="nodeId" value="${nodeId}" />
    <input type="hidden" id="modelId" name="modelId" value="${modelId}" />
    <input type="hidden" name="warningSetJson" id="warningSetJson">
</form>
</div>
<script id="warningTemplate" type="text/html">
    <tr>
        <td>
            <input class="layui-input" type="text" name="warnName"/>
        </td>
        <td>
            <select name="relativeType">
                <option value="before">之前</option>
                <option value="after">之后</option>
            </select>
        </td>
        <td>
            <div class="layui-input-inline time">
                <input class="layui-input time" type="text" name="reminderDueDay" lay-verify="number" value="0"/>
            </div>
            <span>天</span>
            <div class="layui-input-inline time">
                <select name="reminderDueHour">
                <#list 0..23 as h>
                    <option value="${h}" >${h}</option>
                </#list>
                </select>
            </div>
            <span>小时</span>
            <div class="layui-input-inline time">
                <select  name="reminderDueMinute">
                <#list 1..4 as m>
                    <option value="${m}">${m}</option>
                </#list>
                <#list 1..11 as m>
                    <option value="${m*5}">${m*5}</option>
                </#list>
                </select>
            </div>
            <span>分钟</span>
        </td>
        <td>
            <select name="level">
            <#list warningSettingList as warningSetting>
                <option value="${warningSetting.level}">${warningSetting.name}</option>
            </#list>
            </select>
        </td>
        <td>
            <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="delWaringLine(this)"><i class="layui-icon layui-icon-delete"></i>删除</a>
        </td>
    </tr>
</script>
<script>
    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','table', 'form','setter','layedit','layer','commons'], function () {
        var table = layui.table;
        var form = layui.form;
        var setter = layui.setter;
        var $ = layui.$;
        var layer = layui.layer;
        var layedit = layui.layedit;
        var commons = layui.commons;
        var layeditIndex = layedit.build('msgContent'); //建立编辑器

        var action = '${taskReminder.action}';
        if(action!=""){
            $("select[name='action']").val(action);
        }

        var times ='${taskReminder.times}';
        if(times>0){
            $("#needSendMsg").prop("checked", true);
            $(".send-msg-tr").show();
        }
        form.render();

        $('#tip').hover(function () {
            layer.tips('条件表达式要求是返回Boolean值的脚本。返回true,表示满足条件；返回false,表示不满足条件。如果表达式为空，将视为返回true。', '#tip');
        },function () {
            layer.tips.close
        });
        //点击明细按钮 展开面板
        $('.taskDetails>p>i').click(function () {
            $(this).parent().parent().toggleClass('Open');
            $(this).parent().parent().parent().prev().toggleClass("taskTableShou");
            $(this).toggleClass("layui-icon-next");
            $(this).siblings('span').toggle();
            $(this).parent().siblings('div').children('.tableDetails').toggle();
            //执行表格“尺寸结构”的重置，一般写在对应的事件中
            // table.resize('processTask');
        });
        //常用脚本
        $(".commonScript").click(function(){
            var obj = $(this);
            var scriptWin;
            parent.layer.open({
                type: 2,
                area: ["800px","650px"],
                title: ['脚本'],
                content:serverPath.formPath + "/form/table/view/script?param=3",
                success: function(layero, index){
                    scriptWin = parent.window[layero.find('iframe')[0]['name']];
                },
                end: function(){
                    if(scriptWin.layui.scriptText){
                        obj.parent('div').siblings('textarea').html(scriptWin.layui.scriptText);
                    }
                }
            });
        });

        //表单变量选择
        form.on('select(flowVar)', function(data){
            var value= data.value;
            var html = $(data.elem).parent('div').parent('div').siblings('textarea').html()+value;
            $(data.elem).parent('div').parent('div').siblings('textarea').html(html);
        });

        //到期动作设置选择事件
        form.on('select(action)', function(data){
            var value= data.value;
            changeAction(value);
        });
        function changeAction(value){
            $(".choose-assigner").hide();
            $(".execute-script").hide();
            if(value==7){//选择执行脚本
                $(".execute-script").show();
            }
            if(value==5){//选择交办
                $(".choose-assigner").show();
            }
        }

        form.on('checkbox(needSendMsg)', function(data){
            var sendMsg = data.elem.checked;
            if(sendMsg){
                $(".send-msg-tr").show();
            }
            else{
                $("select[name='times']").val(0);
                $(".send-msg-tr").hide();
            }
        });

        //选择交办人员
        $(".chooseAssigner").click(function(){
            var userSelectorWin;
            var body;
            parent.layer.open({
                type: 2,
                title: '人员选择器',
                area: ['760px','630px'],
                btn:["保存","取消","撤销"],
                content:serverPath.systemPath + setter.sysLinkPath+ "dialog/view/singleSysUserDialog",
                success: function(layero, index){
                    userSelectorWin = parent.window[layero.find('iframe')[0]['name']];
                    body = parent.layer.getChildFrame('body',index);
                },
                yes:function (index,layero) {
                    //执行iframe页的save方法
                    userSelectorWin.saveData(index);
                    var theUserList = body.find("input[name=selectUser]").val();
                    if (theUserList) {
                        var item = JSON.parse(theUserList);
                        var userId = item.userId;
                        var userName = item.fullName;
                        $("input[name='assignerId']").val(userId);
                        $("input[name='assignerName']").val(userName);
                    }
                    parent.layer.close(index);
                },
                btn3:function (index, layero) {
                    userSelectorWin.cancelData(index);
                    return false //开启该代码可禁止点击该按钮关闭
                }
            })
        });

        var getTpl = warningTemplate.innerHTML;
        addWarning = function(){
            var WarningTable = $("#taskWarningSetList");
            WarningTable.append(getTpl);
            form.render();
        };

        delWaringLine=function (me){
            $(me).closest("tr").remove();
        };

        slectTemplate=function(){
            var scriptWin;
            parent.layer.open({
                type: 2,
                area: ["800px","650px"],
                title: ['信息内容模板'],
                content: serverPath.workflowPath + setter.workflowLinkPath+ "sysTemplate/view/dialog",
                success: function(layero, index){
                    scriptWin = parent.window[layero.find('iframe')[0]['name']];
                },
                end: function(){
                    if(scriptWin.layui.templateHtml){
                        layedit.setContent(layeditIndex,scriptWin.layui.templateHtml);
                    }
                }
            });
        };
        //保存
        save = function(){
            handtaskWarningSet();
            var name=$("#name").val();
            if(!name){
                layer.msg('请输入任务催办名称', {icon: 5});
                return;
            }
            //是否需要发送催办信息
            var needSendMsg = $("#needSendMsg").is(":checked");
            if(needSendMsg){
                //相对时间
                var ctime=getTotalMinute($("#completeTr"));
                //开始发送时间
                var stime=getTotalMinute($("#startTr"));
                //每次时间间隔*催办次数。
                var etime=getTotalMinute($("#endTr")) * (parseInt($("#times").val())-1);
                if(ctime<stime+etime){
                    layer.msg('相对时间不能比催办时间短', {icon: 5});
                    return;
                }
            }
            layedit.sync(layeditIndex);
            var params=$('#taskReminderForm').serialize();
            var url=serverPath.workflowPath + setter.workflowLinkPath+"taskReminder/save";
            $.post(url,params,function(data){
                if(commons._filterRecord(data)){
                    layer.alert(data.msg+"是否继续操作", {icon:1,title:'操作',
                            btn: ['确定', '取消'],
                        btn2: function(index, layero){
                            //按钮【取消】的回调
                            layer.close(index);
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
                        }
                    },function(index, layero){
                        //按钮【确定】的回调
                        layer.close(index);
                        var url = serverPath.workflowPath + setter.workflowLinkPath + "taskReminder/view/add?procDefId=" + $("#procDefId").val() + "&nodeId=" +
                            $("#nodeId").val();
                        if($("#parentProcDefId").val()){
                            url += "&parentProcDefId=" + conf.parentProcDefId;
                        }
                        if($("#taskDueId").val()){
                            window.location.href=url;
                        }else{
                            window.location.reload();
                        }
                    });
                }else{
                    layer.msg(data.msg, {icon:5});
                }
            },'json');
        };

        /**
         * 获取预警设置
         */
        function handtaskWarningSet(){
            var index=-1;
            var warningTable = $("#taskWarningSetList");
            var warningSetList = [];
            warningTable.children().each(function(){
                index++;
                if(index==0){
                    return;
                }
                var tr = $(this);
                var name = $("[name='warnName']",tr).val();
                if(name){
                    var reminderDueDay = $("[name='reminderDueDay']",tr).val();
                    var reminderDueHour = $("[name='reminderDueHour']",tr).val();
                    var reminderDueMinute = $("[name='reminderDueMinute']",tr).val();
                    var relativeType = $("[name='relativeType']",tr).val();
                    var level = $("[name='level']",tr).val();

                    warningSetList.push(
                        { name:name,
                            reminderDueDay:reminderDueDay,
                            reminderDueHour:reminderDueHour,
                            reminderDueMinute:reminderDueMinute,
                            relativeType:relativeType,
                            level:level
                        });
                }
            });
            $("#warningSetJson").val(JSON.stringify(warningSetList));
        }

        /**
         * 获取总的分钟数
         * @param e
         * @returns {number}
         */
        function getTotalMinute(e){
            var t=0;
            $(e).find(".dayInput").each(function(){
                t+= parseInt(24*60*this.value);
            });
            $(e).find(".hourInput").each(function(){
                t+=parseInt(60*this.value);
            });
            $(e).find(".minuteInput").each(function(){
                t+=parseInt(this.value);
            });
            return t;
        }

        /**
         * 删除催办设置
         */
        delReminder = function(taskDueId){
            layer.confirm('确定删除吗？', function (index) {
                layer.close(index);
                $.ajax({
                    url: serverPath.workflowPath + setter.workflowLinkPath + "taskReminder/del",
                    type: "post",
                    dataType: 'json',
                    data: {taskDueId: taskDueId},
                    success: function (data) {
                        if (commons._filterRecord(data)) {
                            var url = serverPath.workflowPath + setter.workflowLinkPath + "taskReminder/view/add?procDefId=" + $("#procDefId").val() + "&nodeId=" +
                                $("#nodeId").val();
                            if($("#parentProcDefId").val()){
                                url += "&parentProcDefId=" + conf.parentProcDefId;
                            }
                            window.location.href=url;
                        } else {
                            window.parent.layer.alert(data.msg);
                        }
                    }
                })
            });
        };

        edit = function(taskDueId){
            var url = serverPath.workflowPath + setter.workflowLinkPath + "taskReminder/view/add?id="+taskDueId+"&procDefId=" + $("#procDefId").val() + "&nodeId=" +
                $("#nodeId").val();
            if($("#parentProcDefId").val()){
                url += "&parentProcDefId=" + conf.parentProcDefId;
            }
            window.location.href=url;
        };

        addNew = function(){
            var url = serverPath.workflowPath + setter.workflowLinkPath + "taskReminder/view/add?procDefId=" + $("#procDefId").val() + "&nodeId=" +
                $("#nodeId").val();
            if($("#parentProcDefId").val()){
                url += "&parentProcDefId=" + conf.parentProcDefId;
            }
            window.location.href=url;
        };
    });
</script>
<style>
    .time{
        width: 60px !important;
    }
    .green {
        color: #69aa46 !important
    }
    .shortInput{
        width: 200px;
        display: inline;
    }
    .send-msg-tr{
        display:none;
    }
    .choose-assigner{
        display:none;
    }
    .execute-script{
        display:none;
    }
    .th{
        text-align: center !important;
    }
    #LAY_app{
        background: #fff;
    }
    .taskDetails > p{
        background: #e6e6e6;
    }
    .taskDetails>p>i{
        margin: 10px 5px;
        width: 16px;
        cursor: pointer;
        float: left;
    }
    .taskDetails > p >span{
        /*display: none;*/
        float: left;
        line-height: 37px;
    }
    .taskDetails{
        width: 30px;border: 1px solid #e6e6e6;height: 100%;
    }
    .clearfix:after{content:"";display:block;clear:both;height:0;line-height:0;visibility:hidden;}
    .clearfix{zoom:1;}
    div.Open{
        width: 270px;
    }
    div.Open>p>i{
        margin: 10px;
    }
    div.taskTableShou{
        right:290px !important;
    }
    .tableDetails tr td{
        text-align: center;
    }
</style>
</body>
</html>